﻿<%@ WebHandler Language="C#" Class="SIPO.Web.AjaxHandler.Loaddata.validasinpwpafterdebtor" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using SIPO.Library.DataAccess.Administration.Catalog;
using SIPO.Library.DomainObject.Administration.Catalog;
using SIPO.Library.Enum;
using SIPO.Web.Support;
using Newtonsoft.Json.Linq;
using System.Text;
namespace SIPO.Web.AjaxHandler.Loaddata
{
    public class validasinpwpafterdebtor : SIPO.Web.BaseHandler
    {
        recDebtorRepo recDebtorDal = new recDebtorRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
        public override void ProcessRequest(HttpContext context)
        {
            base.ProcessRequest(context);
            string npwp = string.Empty;
            decimal debtorId = 0;
            recDebtor recDebtor = null;
            recDebtor = recDebtorDal.GetByNPWP(context.Request.Params["npwp"].Trim());
            if (recDebtor != null)
            {
                npwp = recDebtor.NPWP;
                debtorId = recDebtor.DebtorID;
            }

            StringBuilder sbProject = new StringBuilder();
            sbProject.Append("{");
            sbProject.AppendFormat("  {0}NPWP{0}:{0}{1}{0}", "\"", npwp);
            sbProject.Append(",");
            sbProject.AppendFormat("  {0}DebtorID{0}:{0}{1}{0}", "\"", debtorId);
            sbProject.Append("}");

            context.Response.Write(sbProject.ToString());
        }

        public override bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}